//
// Created by jsjxsy on 2022/8/18.
//
#include <iostream>
using namespace std;
class Base {
 public:
  string name = "li si";
};

class Derived : public Base {
 public:
  int age = 10;
};
int main() {
  Derived d;
  const Derived *p = &d;//不能修改值
  //p->age = 12;
  Derived *p2 = const_cast<Derived *>(p);
  p2->age = 12;
  cout << "p2->age" << p2->age << endl;

  const Base *p3 = const_cast<Derived *>(p);
  cout << p3->name << endl;
  return 0;
}
